Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dev-tools to support Go Workspace #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

belimawr
Copy link
Contributor

@belimawr belimawr commented May 23, 2023

What does this PR do?

This commit updates the dev-tool code to support Go Workspace.

Why is it important?

Go Workspaces facilitates working on multiple modules at the same time, Elastic-Agent and Beats share a number of modules and sometimes it's necessary to change more than one at once.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas~~
    ~~- [ ] I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.md

How to test this PR locally

  1. Clone elastic-agent, beats and elastic-agent-libs on the same folder
  2. Create a multi-module workspace: go work init
  3. Add all 3 modules to the workspace:
    go work use elastic-agent beats elastic-agent-libs
    
  4. Build the Elastic-Agent (set PLATFORMS according to your platform)
    DEV=true SNAPSHOT=true EXTERNAL=false PLATFORMS="linux/amd64" PACKAGES="tar.gz" mage -v package
    
  5. The build should succeed

## Related issues

This commit updates the dev-tool code to support Go Workspace.
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-05-23T10:58:58.831+0000

  • Duration: 9 min 47 sec

Test stats 🧪

Test Results
Failed 0
Passed 787
Skipped 5
Total 792

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@belimawr belimawr marked this pull request as ready for review May 23, 2023 12:49
@belimawr belimawr requested a review from a team as a code owner May 23, 2023 12:49
@belimawr belimawr requested review from ycombinator and leehinman and removed request for a team May 23, 2023 12:50
lines, err := getLines(callGo(nil, "list", "-m"))
// `go list -buildvcs=false -f '{{.Module}}'` produces the same output as `go list -m`
// and it works with go workspace
lines, err := getLines(callGo(nil, "list", "-buildvcs=false", "-f", "{{.Module}}"))
Copy link
Contributor

@ycombinator ycombinator May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need -buildvcs=false here? AFAICT it's not an option supported by go list. It looks like that option is only supported by go build. Also, running just go list -f {{.Module}} seems to work.

Suggested change
lines, err := getLines(callGo(nil, "list", "-buildvcs=false", "-f", "{{.Module}}"))
lines, err := getLines(callGo(nil, "list", "-f", "{{.Module}}"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants